<template>
    <div class="qilin-">
        <QilinUploadFile :uploadFileConfig.sync="uploadFileConfig"
            :fileList='[
                {
                    fileName: "/profile/upload/2024/04/16/微信图片_20240401163930_20240416172625A002.png",
                    newFileName: "微信图片_20240401163930_20240416172625A002.png",
                    originalFilename: "微信图片_20240401163930.png",
                    url: "http://47.122.16.23:8081/profile/upload/2024/04/16/微信图片_20240401163930_20240416172625A002.png"
                }
            ]'
            @success="(value)=>{
                uploadFileSuccess(value);
            }"
            @actionSuccess="(res,file)=>{
                uploadFileActionSuccess(res,file);
            }"
        ></QilinUploadFile>
        <QilinUploadFile :uploadFileConfig.sync="uploadFileConfig1"
            :fileList='[
                {
                    fileName: "/profile/upload/2024/04/16/微信图片_20240401163930_20240416172625A002.png",
                    newFileName: "微信图片_20240401163930_20240416172625A002.png",
                    name: "微信图片_20240401163930_20240416172625A002.png",
                    originalFilename: "微信图片_20240401163930.png",
                    url: "http://47.122.16.23:8081/profile/upload/2024/04/16/微信图片_20240401163930_20240416172625A002.png"
                }
            ]'
            @success="(value)=>{
                uploadFileSuccess(value);
            }"
        ></QilinUploadFile>
    </div>
</template>

<script>
export default {
    data(){
        return {
            uploadFileConfig:{
                action:"http://47.122.16.23:8081/common/upload",
                headers:{
                    Authorization:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJzeXNfdXNlcjoyNDIiLCJyblN0ciI6InUybGFpN1ZpblZlcGJnVldrSkg2cEtrUlFCTFE0aU4wIiwidXNlcklkIjoyNDJ9.cDAuYpoatac86balVqxq7ZC3kJbMIgElnP_Sz9OSi_M"
                },
                autoUpload:true,
                limit:3,
                fileType:["png","jpg","jpeg","gif"],
                fileList:[],
                fileOptions:{
                    serverName:"originalFilename"
                },
                uploadText:"拖入此处上传或点击上传--指定action上传方式",
                previewFn:(item)=>{
                    console.log(item);
                },
                downloadFn:(item)=>{
                    console.log(item);
                }
            },
            uploadFileConfig1:{
                limit:3,
                fileType:["png","jpg","jpeg","gif"],
                uploadText:"拖入此处上传或点击上传--无action上传方式",
                fileList:[],
                previewFn:(item)=>{
                    console.log(item);
                },
                downloadFn:(item)=>{
                    console.log(item);
                }
            }
        }
    },
    methods:{
        uploadFileSuccess(value){
            console.log(value);
        },
        uploadFileActionSuccess(res,file){
            console.log(res,file);
            this.uploadFileConfig.fileList.push({...res[(this.uploadFileConfig.fileOptions && this.uploadFileConfig.fileOptions.responseDataName) || 'data'],raw:file.raw});
        },
    },
    mounted(){

    }
}
</script>

<style lang="scss" scoped>

</style>
